Unknown CMake command "python3 您所在的位置:网站首页 cmake add library Unknown CMake command "python3

Unknown CMake command "python3

2023-04-03 10:44| 来源: 网络整理| 查看: 265

Hi,

In my CMakeLists for a Python wrapper, I’ve got:

find_package(Python3 REQUIRED) add_subdirectory()

When calling cmake I’ve got (on CMake 3.19+, same behaviour on Linux or windows)

CMake Error at …/third_party/pybind11/tools/pybind11NewTools.cmake:189 (python3_add_library): Unknown CMake command “python3_add_library”.

I find numerous references to this error on the net but without solution.

Regards, A. I’ve just stumbled on https://gitlab.kitware.com/cmake/cmake/-/issues/23133 thus I replaced find_package(Python3 REQUIRED) by

find_package(Python3 REQUIRED Development) find_package(Python3 REQUIRED Interpreter)

which helped me going through the configuration and generation phase. But why is it needed to require both component, omitting component is not the same as requiring all of them? OK, from doc: For calls where no components are specified, there is no single expected behavior and target packages should clearly define what occurs in such cases. Common arrangements include assuming it should find all components, no components or some well-defined subset of the available components. and in FindPython3 doc If no COMPONENTS are specified, Interpreter is assumed.

I leave the post though as I assume, from my google search, that other may have the same issue and I hope that this may be of some help.

PS I’d like to mark my own post as solution but it seems to be forbidden



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有